package com.hndct.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MyWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(loginInterceptor())
			.excludePathPatterns("/user/login");
			/*.excludePathPatterns("/user/noLogin")
			.excludePathPatterns("/user/register")
			.excludePathPatterns("/msg/mobile/code/global")
			.excludePathPatterns("/wallet/sendSynTransactionData")
			.excludePathPatterns("/wallet/updateTransationStatus")
			.excludePathPatterns("/wallet/updateTransationApoStatus")
			.excludePathPatterns("/wallet/sendSynTransactionApoData")
			.excludePathPatterns("/wallet/income")
			.excludePathPatterns("/msg/country/code")
			.excludePathPatterns("/admin/getAdminInfoNoLogin")
			.excludePathPatterns("/admin/getBtcLineNoLogin")
			.excludePathPatterns("/admin/getPoolStatus")
			.excludePathPatterns("/mining/noLoginHome");*/
		
        super.addInterceptors(registry);
	}
	
	/**
	 * 解决在拦截器中不能注入redisService的问题
	 */
	@Bean
	public LoginInterceptor loginInterceptor(){
		return new LoginInterceptor();
	}

}
